package Thread;

/**
 * 赖汉模式创建单例模式
 */
class SingleLazy{
    private  static  SingleLazy instance = null;
    public  static  SingleLazy getInstance(){
        if (instance == null){
            instance = new SingleLazy();
        }
        return instance;
    }
    private SingleLazy(){

    }
}
public class Demo25 {
    public static void main(String[] args) {
        SingleLazy s1 = SingleLazy.getInstance();
        SingleLazy s2 = SingleLazy.getInstance();
        System.out.println(s1==s2);
        //SingleLazy s3 = new SingleLazy();
    }
}
